package util

import (
	"strings"
	"time"
)

func Getunix() string {
	timeUnix := time.Now().Unix() //时间戳
	cretime := time.Unix(timeUnix, 0).Format("2006-01-02 15:04:05")
	return cretime
}

func Daytime(day int) string {
	nowTime := time.Now()
	getTime := nowTime.AddDate(0, 0, day)
	resTime := getTime.Format("2006-01-02 15:04:05")
	return resTime
}

func GetDay() string {
	today := time.Now()
	yesterday := today.AddDate(0, 0, 0)
	timeStr := yesterday.Format("2006-01-02")
	return timeStr
}

func Timepref(time string) string {
	result := strings.Split(time, " ")
	return result[0]
}
